package com.ovopark.organize.server.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.ovopark.organize.server.mapper.FranchiseesApprovalTemplateFieldSelectFillMapper;
import com.ovopark.organize.server.model.entity.FranchiseesApprovalTemplateFieldSelectFill;
import com.ovopark.organize.server.service.FranchiseesApprovalTemplateFieldSelectFillService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wxb
 * @Title: FranchiseesApprovelServiceImpl
 * @Description: 加盟商立项模板字段选择项 填空
 * @date 2024/4/11 15:51
 **/
@Service
@Slf4j
public class FranchiseesApprovalTemplateFieldSelectFillServiceImpl extends ServiceImpl<FranchiseesApprovalTemplateFieldSelectFillMapper, FranchiseesApprovalTemplateFieldSelectFill> implements FranchiseesApprovalTemplateFieldSelectFillService {


    /**
     * @description: 获取选项下的填空配置
     * @param: [selectId]
     * @return: java.util.List<com.ovopark.organize.server.model.entity.FranchiseesApprovalTemplateFieldSelectFill>
     * @author wxb
     * @date: 2024/6/3 14:17
     */
    @Override
    public List<FranchiseesApprovalTemplateFieldSelectFill> getSelectFillListBySelectId(Integer selectId) {
        if (selectId == null) {
            return Lists.newArrayList();
        }
        LambdaQueryWrapper<FranchiseesApprovalTemplateFieldSelectFill> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(FranchiseesApprovalTemplateFieldSelectFill::getSelectId, selectId);
        queryWrapper.eq(FranchiseesApprovalTemplateFieldSelectFill::getIsDeleted, 0);
        queryWrapper.orderByAsc(FranchiseesApprovalTemplateFieldSelectFill::getSort);
        return this.baseMapper.selectList(queryWrapper);
    }
}
